<template>
  <div>
    <div class="advertisise">
      <img src="../assets/images/buyBG.png" alt="" />
    </div>

    <!-- 头部标题组件 -->
    <headerTitle>{{ msg }}</headerTitle>
    <!-- 分类导航 -->
    <div class="buyNav">
      <div class="item" v-for="(item, index) in buyCate" :key="index">
        <img :src="item" />
      </div>
    </div>
    <div class="sellArea">
      <!-- 促销专场 -->
      <div class="specialPromotions">
        <div class="title">
          <span>促销专场</span>
          <div>更多<i class="iconfont icon-youjiantou"></i></div>
        </div>
        <ul>
          <li class="item">
            <h4>8.11-8.22...</h4>
            <h5>没满79减30</h5>
            <img src="../assets/images/29264354-1_b_12.jpg" />
          </li>
          <li class="item">
            <h4>8.11-8.22...</h4>
            <h5>没满79减30</h5>
            <img src="../assets/images/29264354-1_b_12.jpg" />
          </li>
          <li class="item">
            <h4>8.11-8.22...</h4>
            <h5>没满79减30</h5>
            <img src="../assets/images/29264354-1_b_12.jpg" />
          </li>
          <li class="item">
            <h4>8.11-8.22...</h4>
            <h5>没满79减30</h5>
            <img src="../assets/images/29264354-1_b_12.jpg" />
          </li>
          <li class="item">
            <h4>8.11-8.22...</h4>
            <h5>没满79减30</h5>
            <img src="../assets/images/29264354-1_b_12.jpg" />
          </li>
          <li class="item">
            <h4>8.11-8.22...</h4>
            <h5>没满79减30</h5>
            <img src="../assets/images/29264354-1_b_12.jpg" />
          </li>
        </ul>
      </div>

      <!-- 分区 -->
      <buyCar
        v-for="(item, index) in data.columns"
        :key="item.navName"
        :item="item"
        :index="index"
      />
    </div>
    <!-- 底部链接 -->
    <footer-link />
  </div>
</template>

<script>
import Swiper from "swiper";
import footerLink from "../components/base/footerLink.vue";
import buyCar from "../components/buy/buyCar.vue";
import headerTitle from "../components/base/headerTitle.vue";

export default {
  components: {
    footerLink,
    buyCar,
    headerTitle,
  },
  data() {
    return {
      msg: "值得买",
      sty1: "background-image: linear-gradient(133deg,#f296bd,#ee3b31)",
      sty2: "background-image: linear-gradient(127deg,#ff83fb,#e24286)",
      sty3: "background-image: linear-gradient(133deg,#e5a9ff,#8e21fc);",
      sty4: "background-image: linear-gradient(133deg,#f296bd,#ee3b31)",
      buyCate: [
        "https://img61.ddimg.cn/2018/8/25/20180825153505715.png",
        "https://img61.ddimg.cn/2018/8/25/2018082515383576435.png",
        "https://img61.ddimg.cn/2018/8/25/2018082515395286917.png",
        "https://img63.ddimg.cn/2018/8/31/2018083116044590576.png",
        "http://img63.ddimg.cn/upload_img/00660/h5/ddpp-1537350824.png",
        "https://img62.ddimg.cn/2018/8/31/2018083116363087335.png",
        "https://img62.ddimg.cn/2018/8/31/2018083116355544875.png",
        "https://img61.ddimg.cn/2018/8/31/2018083116365438226.png",
        "https://img62.ddimg.cn/2018/8/31/2018083116373380162.png",
        "http://img60.ddimg.cn/upload_img/00782/h5/coupon-1537505152.png",
      ],
      data: [],
    };
  },
  mounted() {
    window.addEventListener("beforeunload", window.scroll(0, 0));

    new Swiper(".swiper-container", {
      slidesPerView: 3,
      spaceBetween: 10,
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },
    });
  },
  created() {
    this.data = require("../../public/jSON/buy");
    console.log(this.data);
  },
};
</script>

<style lang="less">
.advertisise {
  width: 100%;
  img {
    width: 100%;
  }
}

.buyNav {
  border-top: 1px solid #999;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
  .item {
    background-color: white;
    width: 19.8%;
    margin-bottom: 1px;
    img {
      width: 100%;
    }
    h5 {
      text-align: center;
      color: #943dff;
    }
  }
}
// .sellArea{
//     padding-bottom: 100px;
// }
.specialPromotions {
  padding: 0px 13px 13px;
  background-image: url("../assets/images/cuxiao.png");
  background-size: cover;
  .title {
    text-align: center;
    position: relative;
    font-size: 18px;
    color: white;
    padding-top: 16px;
    padding-bottom: 5px;
    font-weight: bold;
    div {
      position: absolute;
      right: 0;
      top: 22px;
      font-size: 12px;
      font-weight: normal;
      i {
        font-size: 12px;
      }
    }
  }
  ul {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .item {
      width: 32.5%;
      padding: 10px 10px 5px;
      box-sizing: border-box;
      background-color: white;
      // text-align: center;
      border-radius: 10px;
      margin-top: 6px;
      overflow: hidden;
      img {
        width: 80%;
        margin: 5px auto;
      }
      h4 {
        font-size: 15px;
        color: #565656;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      h5 {
        text-align: center;
        font-size: 14px;
        color: #943dff;
      }
    }
  }
}

.footer {
  background-color: white;
  height: 160px;
  padding-bottom: 15px;
  .login_nav {
    height: 45px;
    background-color: white;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    div {
      display: flex;
      align-items: center;
      div {
        margin-left: 20px;
        font-size: 14px;
      }
    }
    .backTop {
      display: flex;
      align-items: center;
      margin-right: 10px;
      font-size: 12px;
      img {
        width: 11px;
      }
    }
  }
  .order_nav {
    height: 26px;
    line-height: 26px;
    text-align: center;
    a {
      margin: 0px 5px;
      font-size: 15px;
    }
  }
  .copyright {
    p {
      font-size: 12px;
      color: #999;
      text-align: center;
    }
  }
}
</style>